<?php

/**
 * Template form base class.
 *
 * @method Template getObject() Returns the current form's model object
 *
 * @package    campaign_generation
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseTemplateForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                        => new sfWidgetFormInputHidden(),
      'name'                      => new sfWidgetFormInputText(),
      'deleted'                   => new sfWidgetFormInputText(),
      'footer_id'                 => new sfWidgetFormInputText(),
      'show_comments'             => new sfWidgetFormInputText(),
      'comment_header'            => new sfWidgetFormInputText(),
      'comment_login_description' => new sfWidgetFormTextarea(),
      'comment_button_caption'    => new sfWidgetFormInputText(),
      'show_rating'               => new sfWidgetFormInputText(),
      'rate_txt'                  => new sfWidgetFormTextarea(),
      'rating_sorting_id'         => new sfWidgetFormInputText(),
      'alias_when_footer'         => new sfWidgetFormInputText(),
      'include_api_code'          => new sfWidgetFormInputText(),
      'search_str'                => new sfWidgetFormInputText(),
      'search_types'              => new sfWidgetFormInputText(),
      'search_results_count'      => new sfWidgetFormInputText(),
      'include_weather_api'       => new sfWidgetFormInputText(),
      'weather_target'            => new sfWidgetFormInputText(),
      'include_maps_api'          => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'                        => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'name'                      => new sfValidatorString(array('max_length' => 255)),
      'deleted'                   => new sfValidatorInteger(array('required' => false)),
      'footer_id'                 => new sfValidatorInteger(array('required' => false)),
      'show_comments'             => new sfValidatorInteger(array('required' => false)),
      'comment_header'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'comment_login_description' => new sfValidatorString(array('required' => false)),
      'comment_button_caption'    => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'show_rating'               => new sfValidatorInteger(array('required' => false)),
      'rate_txt'                  => new sfValidatorString(array('max_length' => 256, 'required' => false)),
      'rating_sorting_id'         => new sfValidatorInteger(array('required' => false)),
      'alias_when_footer'         => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'include_api_code'          => new sfValidatorInteger(array('required' => false)),
      'search_str'                => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'search_types'              => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'search_results_count'      => new sfValidatorInteger(array('required' => false)),
      'include_weather_api'       => new sfValidatorInteger(array('required' => false)),
      'weather_target'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'include_maps_api'          => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('template[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Template';
  }

}
